# 获取当前源文件所在目录的绝对路径
get_filename_component(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)

# 将该目录下所有源文件添加到 SRC_LIST 变量中
aux_source_directory(${SRC_DIR} SRC_LIST)

# find_package(OpenSSL REQUIRED)
include_directories(/usr/openssl-arm64/include/)
# find_package(Protobuf REQUIRED)

set(PROTOBUF_FILES ${PROJECT_SOURCE_DIR}/src/DDAP/DDAP.pb.cc)

#设置查找路径
# set(PROTOBUF_LIBRARY /usr/local/lib/libprotobuf.so)
#将SRC_LIST中的源文件创建一个静态库，idtrans_lib
add_library(ReactorServer_lib SHARED ${SRC_LIST})

set_target_properties(ReactorServer_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)

target_include_directories(ReactorServer_lib PUBLIC ${PROJECT_OPENSSL_INCLUDE_DIR} ${PROJECT_PROTOBUF_INCLUDE_DIRS})
target_link_libraries(ReactorServer_lib ThreadTool_lib log_lib  CryptoTools_lib DDAP_lib utilTool_lib ${PROJECT_PROTOBUF_LIBRARY} ${PROJECT_OPENSSL_LIBRARIES} )

set_target_properties(ReactorServer_lib PROPERTIES
    BUILD_WITH_INSTALL_RPATH FALSE     # 在构建时使用安装 RPATH
    INSTALL_RPATH "${PROJECT_CMAKE_INSTALL_RPATH}"
    BUILD_RPATH "${PROJECT_CMAKE_BUILD_RPATH}"
)

set(src_ReactorServer ${SRC_LIST} CACHE INTERNAL "Description of the variable")
